import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    token: localStorage.getItem('token') || '',
    refresh_token: localStorage.getItem('refresh_token') || '',
    user: {
      photo: localStorage.getItem('photo') || ''
    }
  },
  mutations: {
    setToken (state, val) {
      state.token = val
    },
    setRefreshToken (state, val) {
      state.refresh_token = val
    },
    setUser (state, val) {
      state.user.photo = val
      localStorage.setItem('photo', val)
    }
  },
  actions: {

  },
  modules: {
  }
})
